{include file="member.header.html"}
<style>
    .add_spec li .image.focus{border:1px solid orange}
</style>

{include file="title.html"}
<ul class="bm_tab">
    <li><a href="{url app=my_goods}">{$lang.goods_list}</a></li>
    <li  class="cur"><a href="{url app=my_goods&act=add}">{$lang.add_goods}</a></li>
</ul>
{$build_editor}
<script type="text/javascript">
//<!CDATA[
    var SPEC = {$goods.spec_json};
var spec_array;
    function add_uploadedfile(file_data)
    {
        if (file_data.instance == 'goods_image') {
            $('#goods_images').append('<li ectype="handle_pic" file_id="' + file_data.file_id + '" thumbnail="{$site_url}/' + file_data.thumbnail + '"><input type="hidden" value="' + file_data.file_id + '" name="goods_file_id[]"/><div class="pic"><img src="{$site_url}/' + file_data.thumbnail + '" width="96" height="96" alt="" /><div ectype="handler" class="bg"><p class="operation"><span class="cut_in" ectype="set_cover" ecm_title="{$lang.set_cover}">{$lang.set_cover}</span><span class="delete" ectype="drop_image" ecm_title="{$lang.drop}">{$lang.drop}</span></p></div></div></li>');
            trigger_uploader();
            if ($('#big_goods_image').attr('src') == '{$site_url}/{$goods.default_goods_image}') {
                set_cover(file_data.file_id);
            }
        } else if (file_data.instance == 'desc_image') {
            $('#desc_images').append('<li file_name="' + file_data.file_name + '" file_path="' + file_data.file_path + '" ectype="handle_pic" file_id="' + file_data.file_id + '"><input type="hidden" name="desc_file_id[]" value="' + file_data.file_id + '"><div class="pic" style="z-index: 2;"><img src="{$site_url}/' + file_data.file_path + '" width="100" height="100" alt="' + file_data.file_name + '" /></div><div ectype="handler" class="bg" style="z-index: 3;display:none"><img src="{$site_url}/' + file_data.file_path + '" width="100" height="100" alt="' + file_data.file_name + '" /><p class="operation"><a href="javascript:void(0);" class="cut_in" ectype="insert_editor" ecm_title="{$lang.insert_editor}">{$lang.insert_editor}</a><span class="delete" ectype="drop_image" ecm_title="{$lang.drop}">{$lang.drop}</span></p></div></li>');
            trigger_uploader();
        }else if(file_data.instance == 'spec_image'){
        $('.spec_images').append('<li ectype="handle_pic" file_id="'+ file_data.file_id +'" ><input type="hidden" value="'+ file_data.file_id +'" name="spec_file_id[]"/><div class="pic"><img src="{$site_url}/'+ file_data.file_path +'" width="100" height="100" alt="" /><div ectype="handler" style="display:block;left: 0;top: 100px;padding: 0;" class="bg"><p class="operation" style="padding:0"><span class="cut_in" style="margin:4px 0" onclick="insert_spec('+ file_data.file_id +',\''+file_data.file_path+'\')" ecm_title="插入">插入</span><span class="delete" style="margin:4px 0" onclick="drop_image('+ file_data.file_id +',\''+file_data.file_path+'\')" ecm_title="{$lang.drop}">{$lang.drop}</span></p></div></div></li>');

    }
    }


    function set_cover(file_id) {
        if (typeof(file_id) == 'undefined') {
            $('#big_goods_image').attr('src', '{$site_url}/{$goods.default_goods_image}');
            return;
        }
        var obj = $('*[file_id="' + file_id + '"]');
        $('*[file_id="' + file_id + '"]').clone(true).prependTo('#goods_images');
        $('*[ectype="handler"]').hide();
        $('#big_goods_image').attr('src', obj.attr('thumbnail'));
        obj.remove();
    }

    $(function() {
        $('#goods_form').validate({
            errorPlacement: function(error, element) {
                $(element).next('.field_notice').hide();
                $(element).after(error);
            },
            success: function(label) {
                label.addClass('validate_right').text('OK!');
            },
            onkeyup: false,
            rules: {
                goods_name: {
                    required: true
                },
                price: {
                    number: true,
                    required: true,
                    min: 0
                },
                stock: {
                    digits: true
                },
                cate_id: {
                    remote: {
                        url: 'index.php?app=my_goods&act=check_mgcate',
                        type: 'get',
                        data: {
                            cate_id: function() {
                                return $('#cate_id').val();
                            }
                        }
                    }
                }
            },
            messages: {
                goods_name: {
                    required: '{$lang.goods_name_empty}'
                },
                price: {
                    number: '{$lang.number_only}',
                    required: '{$lang.price_empty}',
                    min: '{$lang.price_ge_0}'
                },
                stock: {
                    digits: '{$lang.number_only}'
                },
                cate_id: {
                    remote: '{$lang.select_leaf_category}'
                }
            }
        });

        // init cover
        set_cover($("#goods_images li:first-child").attr('file_id'));

        // init spec
        spec_update();
    });
//]]>



/* 创建规格编辑器 */
function spec_editor(){
    var hide_drop_button = function ()
    {
        $('#dialog_object_spec_editor').find('*[ectype="drop_spec_item"]').show();
        $('#dialog_object_spec_editor').find('*[ectype="drop_spec_item"]:first').hide();
    }

    /* 规格名称 */
    $('*.[ectype="spec_editor"]').find('*[col="spec_name_1"]').val(SPEC.spec_name_1);
    $('*.[ectype="spec_editor"]').find('*[col="spec_name_2"]').val(SPEC.spec_name_2);
    $('*.[ectype="spec_editor"]').find('*[col="spec_name_3"]').val(SPEC.spec_name_3);
    $('*.[ectype="spec_editor"]').find('*[col="spec_name_4"]').val(SPEC.spec_name_4);
    /* 初始化规格项 */
    $('*.[ectype="spec_editor"]').find('*[ectype="data"]').remove(); // 移除所有规格项
    var d_spec_item = $('*.[ectype="spec_editor"]').find('*[ectype="spec_item"]'); // 规格项模板
    d_spec_item.hide(); // 隐藏模板
    var spec_item; // 规格项目json数组
    if(SPEC.spec_qty ==0){
        spec_item = ['',''];// 如果没有规格则显示两行空白规格项
    }else{
        spec_item = SPEC.specs;
    }
    spec_item && $.each(spec_item,function(i,item){ // 遍历生成规格项
        var tpl = d_spec_item.clone(true); // 克隆一个规格项
        tpl.attr('ectype', 'data'); // 赋值一个ectype与规格项模板区别
        if(item.spec_1){
            tpl.find('*[item="spec_1"]').siblings('.image').attr('src',my_site.replace("/mobile", "")+'/'+item.spec_1);
            tpl.find('*[item="spec_1"]').val(item.spec_1);
        }
        item.spec_2 && tpl.find('*[item="spec_2"]').val(item.spec_2);
        item.spec_3 && tpl.find('*[item="spec_3"]').val(item.spec_3);
        item.spec_4 && tpl.find('*[item="spec_4"]').val(item.spec_4);
        tpl.find('*[item="price"]').val(item.price);
        tpl.find('*[item="stock"]').val(item.stock);
        tpl.find('*[item="sku"]').val(item.sku);
        tpl.find('*[item="spec_id"]').val(item.spec_id);
        tpl.show();
        d_spec_item.before(tpl); // 将克隆的规格项放到模板前面，新增的规格项能按正序排列
    });

    // 创建规格编辑对话框
    var _d = DialogManager.create('spec_editor');
    _d.setTitle($('*[ectype="dialog_contents"]').attr('dialog_title'));
    _d.setContents($('*[ectype="dialog_contents"]').children().clone(true));
    _d.setStyle('add_spec');
    //_d.setStyle({'padding' : '0'});
    _d.setWidth(320);
    //ScreenLocker.style.opacity = 0;
    _d.show('center');
    hide_drop_button();

    // 添加规格项
    $('*[ectype="add_spec_item"]').unbind('click');
    $('*[ectype="add_spec_item"]').click(function(){
        var new_spec = $('#dialog_object_spec_editor').find('*[ectype="data"]:last').clone(true);
        new_spec.find('.image').css('border-color','#eee');
        new_spec.find('input[item="spec_id"]').val('');
        new_spec.insertAfter($('#dialog_object_spec_editor').find('*[ectype="data"]:last'));
        hide_drop_button();
    });

    // {$lang.drop}规格项
    $('*[ectype="drop_spec_item"]').click(function(){
        $('#dialog_object_spec_editor').find('*[ectype="data"]').length > 1 && $(this).parent().parent().remove();
        hide_drop_button();
    });

    // 规格项排序
    $('*[ectype="up_spec_item"]').click(function(){
        var prev = $(this).parent().parent().prev('*[ectype="data"]').clone(true);
        $(this).parent().parent().prev('*[ectype="data"]').remove();
        $(this).parent().parent().after(prev);
        hide_drop_button();
    });
    $('*[ectype="down_spec_item"]').click(function(){
        var prev = $(this).parent().parent().next('*[ectype="data"]').clone(true);
        $(this).parent().parent().next('*[ectype="data"]').remove();
        $(this).parent().parent().before(prev);
        hide_drop_button();
    });

    // 保存规格名称和规格项
    $('*[ectype="save_spec"]').unbind('click');
    $('*[ectype="save_spec"]').click(function(){

        var bak_spec =  SPEC; // 备份

        /* 保存规格名称 */
        var spec_name_1 = $.trim($('#dialog_object_spec_editor').find('*[col="spec_name_1"]').val());
        var spec_name_2 = $.trim($('#dialog_object_spec_editor').find('*[col="spec_name_2"]').val());
        var spec_name_3 = $.trim($('#dialog_object_spec_editor').find('*[col="spec_name_3"]').val());
        var spec_name_4 = $.trim($('#dialog_object_spec_editor').find('*[col="spec_name_4"]').val());
        spec_array=new Array(spec_name_1,spec_name_2,spec_name_3,spec_name_4);
        /* 规格名称是否重复和为空 */
        if(!spec_name_1 && !spec_name_2 && !spec_name_3 && !spec_name_4){
            alert(lang.get('spec_name_required'));
            return;
        }else{
            
            for(var i=0;i<4;i++){
                for(var j=0;j<4;j++){
                    if((i!=j) && spec_array[j] &&(spec_array[i] == spec_array[j])){
                        alert(lang.get('duplicate_spec_name') + '\n' + '[' + spec_array[j]+ ']');
                        return;
                    }
                }
            }
        }
        SPEC = {};
        SPEC.spec_name_1 = spec_name_1;
        SPEC.spec_name_2 = spec_name_2;
        SPEC.spec_name_3 = spec_name_3;
        SPEC.spec_name_4 = spec_name_4;
        SPEC.spec_qty=0;
        /* 保存规格数量 */
                for(var j=0;j<4;j++){
                    if(spec_array[j]){
                        SPEC.spec_qty++;
                    }
                }

        /* 保存规格项 */
        var arr_spec_name = new Array(); // 累积规格项名称。检查重复
        var spec_duplicate = new Array(); // 重复的规格项
        var price_error = new Array();
        var complate = true; // 是否完成
        SPEC.specs = [];
        $('#dialog_object_spec_editor').find('*[ectype="data"]').each(function(){
            var spec_1 = SPEC.spec_name_1 ? $.trim($(this).find('*[item="spec_1"]').val()) : null;
            var spec_2 = SPEC.spec_name_2 ? $.trim($(this).find('*[item="spec_2"]').val()) : null;
            var spec_3 = SPEC.spec_name_3 ? $.trim($(this).find('*[item="spec_3"]').val()) : null;
            var spec_4 = SPEC.spec_name_4 ? $.trim($(this).find('*[item="spec_4"]').val()) : null;
            var price = $.trim($(this).find('*[item="price"]').val());
            var stock = $.trim($(this).find('*[item="stock"]').val());
            var sku = $.trim($(this).find('*[item="sku"]').val());
            var spec_id = $.trim($(this).find('*[item="spec_id"]').val());

            var valid = (spec_1 || spec_2 || spec_3 || spec_4) ? true : false; // 该行数据是否有效
            for(var i=0;i<4;i++){
                if(spec_array[i]){
                    eval('if(spec_' + (i+1) + ' || (!spec_' + (i+1) + ' && !price && !stock && !sku)){}else{complate = false;}');
                }
            }
           
            var item = [spec_1,spec_2,spec_3,spec_4].join(';');
            if($.inArray(item, arr_spec_name) > -1){
                if($.inArray(item, spec_duplicate) == -1){
                    spec_duplicate.push(item);
                }
            }else{
                item != ';;;' && arr_spec_name.push(item);
            }
            /* 判断价格非法 */
            if(isNaN(price) || price <0 || !price){
                valid && price_error.push(item);
            }
            item != ';;;' && SPEC.specs.push({
                'spec_1':spec_1,
                'spec_2':spec_2,
                'spec_3':spec_3,
                'spec_4':spec_4,
                'price':number_format(price, 2),
                'stock':number_format(stock, 0),
                'sku':sku,
                'spec_id':spec_id
                });
        });
        if(arr_spec_name.length == 0){
                complate = false;
        }
        if(complate == false){
            alert(lang.get('spec_not_complate'));
            SPEC = {};
            SPEC = bak_spec; // 还原备份
            return;
        }
        if(spec_duplicate.length>0){
            var spec_msg = '';
            $.each(spec_duplicate,function(i,val){
                spec_msg += val + '\n';
            });

            alert(lang.duplicate_spec + '\n' + spec_msg);
            SPEC = {};
            SPEC = bak_spec; // 还原备份
            return;
        }
        /* 判断价格 */
        if(price_error.length>0){
            var msg = lang.follow_spec_price_invalid + '\n';
            $.each(price_error,function(i,val){
                msg += val + '\n';
            });

            alert(msg);
            SPEC = {};
            SPEC = bak_spec; // 还原备份
            return;
        }

        // 更新显示规格项
        spec_update();

        DialogManager.close('spec_editor');

    });
}
function focus_img(obj){
	$(".add_spec li .image").removeClass('focus');
	obj.addClass('focus');
}
function insert_editor(file_name, path)
{
    ue.execCommand( 'inserthtml', '<img src="{$site_url}/' + path + '" alt="'+ file_name + '">');
}
</script>
    <div class="w320">

            <form method="post" id="goods_form">
                <div class="add_spec" dialog_title="{$lang.edit}{$lang.specification}" ectype="dialog_contents" style="display: none">
                    <!--<form>-->
                    <p>{$lang.note_for_add_spec_popup}</p>
                    <div class="table" ectype="spec_editor">
                        <ul class="th">
                            <li><input col="spec_name_1" type="text" class="text width4" /></li>
                            <li><input col="spec_name_2" type="text" class="text width4" /></li>
                                    <li><input col="spec_name_3" type="text" class="text width4" /></li>
                                    <li><input col="spec_name_4" type="text" class="text width4" /></li>
                            <li class="distance3">{$lang.price}</li>
                            <li class="distance3">{$lang.stock}</li>
                            <li class="distance3">{$lang.sku}</li>
                            <li class="distance3">{$lang.handle}</li>
                        </ul>
                        <ul class="td" ectype="spec_item">
                                    <li>
                                    <input item="spec_1" type="hidden" class="image width4" />
                                    <img class="image" src="{$site_url}/{$goods.default_goods_image}" width="65" height=60 onclick="focus_img($(this))" />
                                    </li>
                          
                            <li><input item="spec_2" type="text" class="text width4" /></li>
                                    <li><input item="spec_3" type="text" class="text width4" /></li>
                                    <li><input item="spec_4" type="text" class="text width4" /></li>
                            <li><input item="price" type="text" class="text width4" /></li>
                            <li><input item="stock" type="text" class="text width4" /></li>
                            <li><input item="sku" type="text" class="text width4" /><input item="spec_id" type="hidden" /></li>
                            <li class="padding3">
                                <span ectype="up_spec_item" class="up_btn"></span>
                                <span ectype="down_spec_item" class="down_btn"></span>
                                <span ectype="drop_spec_item" class="delete_btn"></span>
                            </li>
                        </ul>
                        <ul>
                            <li class="add"><a href="javascript:;" ectype="add_spec_item" class="add_link">{$lang.add_spec_item}</a></li>
                        </ul>
                    </div>
                            <div class="clearfix" style="text-align: center;" ><iframe src="index.php?app=comupload&act=view_iframe&id={$id}&belong={$belong}&instance=spec_image" width="300" height="40" scrolling="no" frameborder="0"></iframe></div>
                            <div class="editor"> 
                            <div class="spec_images spec_pic preview clearfix">
                             <!-- {foreach from=$goods_spec_img item=spec_img} -->
                             <li ectype="handle_pic" file_id="{$spec_img.file_id}" ><input type="hidden" value="{$spec_img.file_id}" name="spec_file_id[]"/><div class="pic"><img src="{$site_url}/{$spec_img.file_path}" width="100" height="100" alt="" /><div ectype="handler" style="display:block;left: 0;top: 100px;padding: 0;" class="bg"><p class="operation" style="padding:0"><span class="cut_in" style="margin:4px 0" onclick="insert_spec({$spec_img.file_id},'{$spec_img.file_path}')" ecm_title="插入">插入</span><span class="delete" style="margin:4px 0" onclick="drop_image({$spec_img.file_id},'{$spec_img.file_path}')" ecm_title="{$lang.drop}">{$lang.drop}</span></p></div></div></li>
                             <!-- {/foreach} -->
                            </div>
                            </div>
                    <input ectype="save_spec" type="submit" class="white_btn" value="{$lang.save_spec}" />
                    <!--</form>-->
                </div>

                    <div class="add_wrap">
                        <div class="assort">
                            <p class="txt">{$lang.mgcategory}: </p>
                            <p class="select" id="gcategory">
                                <!-- {if $goods.cate_id} -->
                                <span class="f_l">{$goods.cate_name|escape}</span>
                                <a class="edit_gcategory btn" href="javascript:;">{$lang.edit}</a>
                                <select style="display:none">
                                    <option>{$lang.select_pls}</option>
                                    {html_options options=$mgcategories}
                                </select>
                                <!-- {else} -->
                                <select>
                                    <option>{$lang.select_pls}</option>
                                    {html_options options=$mgcategories}
                                </select>
                                <!-- {/if} -->
                                <input type="hidden" id="cate_id" name="cate_id" value="{$goods.cate_id}" class="mls_id" />
                                <input type="hidden" name="cate_name" value="{$goods.cate_name|escape}" class="mls_names" />
                            </p>
                        </div>
                        <div class="assort">
                            <p class="txt">{$lang.sgcategory}: </p>
                            <p class="select">
                                <!--{if $goods._scates}-->
                                <!--{foreach from=$goods._scates item=sgcate}-->
                                <select name="sgcate_id[]" class="sgcategory">
                                    <option value="0">{$lang.select_pls}</option>
                                    {html_options options=$sgcategories selected=$sgcate.cate_id}
                                </select>
                                <!-- {/foreach} -->
                                <!--{else}-->
                                <select name="sgcate_id[]" class="sgcategory">
                                    <option value="0">{$lang.select_pls}</option>
                                    {html_options options=$sgcategories}
                                </select>
                                <!--{/if}-->
                            </p>
                            <p class="new_add">
                                <a href="javascript:;" id="add_sgcategory" class="white_btn">{$lang.add_scategory}</a>
                            </p>
                        </div>
                    </div>



                    <div class="add_wrap">
                        <div class="pic_list">
                            <div class="big_pic"><img id="big_goods_image" src="{$site_url}/{$goods.default_goods_image}" width="300" height="300" alt="" /></div>
                            <div class="small_pic">
                                <ul id="goods_images">
                                    <!--{foreach from=$goods_images item=goods_iamge}-->
                                    <li ectype="handle_pic" file_id="{$goods_iamge.file_id}" thumbnail="{$site_url}/{$goods_iamge.thumbnail}">
                                        <input type="hidden" name="goods_file_id[]" value="{$goods_iamge.file_id}">
                                        <div class="pic">
                                            <img src="{$site_url}/{$goods_iamge.thumbnail}" width="100" height="100" />
                                            <div ectype="handler" class="bg">
                                                <p class="operation">
                                                    <span class="cut_in" ectype="set_cover" ecm_title="{$lang.set_cover}">{$lang.set_cover}</span>
                                                    <span class="delete" ectype="drop_image" ecm_title="{$lang.drop}">{$lang.drop}</span>
                                                </p>
                                            </div>
                                        </div>
                                    </li>
                                    <!--{/foreach}-->
                                </ul>
                                <div class="clear"></div>
                            </div>
                            <div class="upload_btn">
                                <iframe src="index.php?app=comupload&act=view_iframe&id={$id}&belong={$belong}&instance=goods_image" width="300" height="40" scrolling="no" frameborder="0"></iframe>
                            </div>
                        </div>
                    </div>

                    <div class="add_wrap clearfix">
                        <div class="products">
                            <ul>
                                <li>
                                    <h2>{$lang.goods_name}: </h2>
                                    <div class="arrange"><input title="{$goods.goods_name|escape}" type="text" name="goods_name" value="{$goods.goods_name|escape}" class="text" /><span class="red">*</span></div>
                                </li>
                                <li>
                                    <h2>{$lang.brand}: </h2>
                                    <div class="arrange"><input type="text" name="brand" value="{$goods.brand|escape}" class="text" /></div>
                                </li>
                                <li>
                                    <h2>{$lang.tags}: </h2>
                                    <div class="arrange"><input type="text" name="tags" value="{$goods.tags|escape}" class="text" />
                                    </div>
                                </li>
                                <li>
                                    <h2  ectype="no_spec">{$lang.price}: </h2>
                                    <div class="arrange"  ectype="no_spec"><input name="spec_id" value="{$goods._specs.0.spec_id}" type="hidden" /><input name="price" value="{$goods._specs.0.price}" type="text" class="text width_short" /></div>
                                </li>
                                <!--{if $goods.integral_enabled}-->
                                <li>
                                    <h2>{$lang.integral_max_exchange}:</h2>
                                    <div class="arrange"><input name="integral_max_exchange" value="{$goods.integral_max_exchange}" type="text" class="text" /><span class="gray">{$lang.integral_max_exchange_note}{$goods.integral_seller}</span></div>
                                </li>
                                <!--{/if}-->
                                <li ectype="no_spec">
                                    <h2>{$lang.stock}: </h2>
                                    <div class="arrange"><input name="stock" value="{$goods._specs.0.stock}" type="text" class="text" /></div>
                                </li>
                                <li ectype="no_spec">
                                    <h2>{$lang.sku}: </h2>
                                    <div class="arrange"><input name="sku" value="{$goods._specs.0.sku}" type="text" class="text" /></div>
                                </li>

                                <li>
                                    <h2>{$lang.spec}: </h2>
                                    <div class="arrange">
                                        <div class="box_arr" ectype="no_spec">
                                            <p class="pos_btn"><a ectype="add_spec" href="javascript:;" class="add_btn">{$lang.enable_spec}</a></p>
                                            <p class="pos_txt">{$lang.note_for_add_spec}</p>
                                        </div>
                                        <div class="box_arr" ectype="has_spec"  style="display: none;">
                                            <table ectype="spec_result">
                                                <tr>
                                                    <th col="spec_name_1">loading..</th>
                                                    <th col="spec_name_2">loading..</th>
                                                    <th col="spec_name_3">loading..</th>
                                                    <th col="spec_name_4">loading..</th>
                                                    <th col="price">{$lang.price}</th>
                                                    <th col="stock">{$lang.stock}</th>
                                                    <th col="sku">{$lang.sku}</th>
                                                </tr>
                                                <tr ectype="spec_item" style="display:none">
                                                    <td item="spec_1"></td>
                                                    <td item="spec_2"></td>
                                                    <td item="spec_3"></td>
                                                    <td item="spec_4"></td>
                                                    <td item="price"></td>
                                                    <td item="stock"></td>
                                                    <td item="sku"></td>
                                                </tr>
                                            </table>
                                            <p class="table_btn">
                                                <a ectype="edit_spec" href="javascript:;" class="add_btn edit_spec">{$lang.edit_spec}</a>
                                                <a ectype="disable_spec" href="javascript:;" class="add_btn disable_spec">{$lang.disable_spec}</a>
                                            </p>
                                        </div>
                                    </div>
                                </li>

                                <li>
                                    <h2>{$lang.if_show}: </h2>
                                    <div class="arrange">
                                        <span class="distance">
                                            <label style="width:130px;display: block;float: left"><input name="if_show" value="1" type="radio" {if $goods.if_show}checked="checked" {/if}/> {$lang.yes}</label>
                                            <label style="width:130px;display: block;float: left"><input name="if_show" value="0" type="radio" {if !$goods.if_show}checked="checked" {/if}/> {$lang.no}</label>
                                        </span>
                                    </div>
                                </li>
                                <li>
                                    <h2>{$lang.recommended}: </h2>
                                    <div class="arrange">
                                        <span class="distance">
                                            <label style="width:130px;display: block;float: left"><input name="recommended" value="1" {if $goods.recommended}checked="checked" {/if}type="radio" /> {$lang.yes}</label>
                                            <label style="width:130px;display: block;float: left"><input name="recommended" value="0" {if !$goods.recommended}checked="checked" {/if}type="radio" /> {$lang.no}</label>
                                        </span>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="add_bewrite">
                        <h5>{$lang.description}</h5>
                        <div class="add_wrap">
                            <div class="editor">
                                <div style="width:320;overflow: scroll">
                                    <textarea name="description" id="description"  style="width:99%; height:400px;">
                                    {$goods.description|escape}
                                    </textarea>
                                </div>
                                <div style=" position: relative; top: 10px; z-index: 5;text-align: center;">
                                    <iframe src="index.php?app=comupload&act=view_iframe&id={$id}&belong={$belong}&instance=desc_image" width="300" height="40" scrolling="no" frameborder="0"></iframe>
                                </div>
                                <ul id="desc_images" class="preview">
                                    <!--{foreach from=$desc_images item=desc_image}-->
                                    <li ectype="handle_pic" file_name="{$desc_image.file_name|escape}" file_path="{$desc_image.file_path}" file_id="{$desc_image.file_id}">
                                        <input type="hidden" name="desc_file_id[]" value="{$desc_image.file_id}">
                                        <div class="pic">
                                            <img src="{$site_url}/{$desc_image.file_path}" width="100" height="100" alt="{$desc_image.file_name|escape}" title="{$desc_image.file_name|escape}" /></div>
                                        <div ectype="handler" class="bg">
                                            <img src="{$site_url}/{$desc_image.file_path}" width="100" height="100" alt="{$desc_image.file_name|escape}" title="{$desc_image.file_name|escape}" />
                                            <p class="operation">
                                                <a class="cut_in" ectype="insert_editor" href="javascript:void(0);" ecm_title="{$lang.insert_editor}">{$lang.insert_editor}</a>
                                                <span class="delete" ectype="drop_image" ecm_title="{$lang.drop}">{$lang.drop}</span>
                                            </p>
                                        </div>
                                    </li>
                                    <!--{/foreach}-->
                                </ul>
                                <div class="clear"></div>
                            </div>
                            <div class="issuance"><input type="submit" class="red_btn" value="{$lang.submit}" /></div>
                        </div>
                    </div>
            </form>

</div>
{include file="footer.html"}